package com.example.a0413demo;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import java.io.ByteArrayOutputStream;

public class ShowFragment extends Fragment {
    TextView tvText;
    String name;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle =getArguments();
        if (bundle!=null){
            name = bundle.getString("name");
        }
    }

    public static Fragment getShowFragment(String name){
        ShowFragment showFragment=new ShowFragment();
        Bundle bundle=new Bundle();
        bundle.putString("name",name);
        showFragment.setArguments(bundle);
        return showFragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_show,null);
        tvText=view.findViewById(R.id.tv_content);
        tvText.setText("name");
        return super.onCreateView(inflater, container, savedInstanceState);

    }
}
